public class SportMan {
    private String name;
    private int age;

    private int sex; // 0,男， 1，女

    private double moneyOfrace;

    public SportMan(String name){
        this.name = name;
    }

    public String getName(){
        return this.name;
    }

    public void setName(String name){
        this.name = name;
    }

    public int getAge(){
        return this.age;
    }

    public void setAge(int age){
        this.age = age;
    }

    public int getSex(){
        return this.sex;
    }

    public void setSex(int sex){
        this.sex = sex;
    }

    public void toPay(double money){
        System.out.println(name + ": 100元缴费！");
        this.moneyOfrace = money;
    }

    public void toRace() throws RaceException{
        if(this.sex==0){
            if(this.age>25 || this.age<=0) {
                throw new RaceException("男选手年龄不能超过25岁！");
            }
        }else if(this.sex==1){
            if(this.age>23 || this.age<=0) {
                throw new RaceException("女选手年龄不能超过25岁！");
            }
        }
    }
}
